package com.glsc.ngateway.common.base.domain.mysql.gateway.platform;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import org.hibernate.annotations.JoinColumnOrFormula;
import org.hibernate.annotations.JoinColumnsOrFormulas;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Set;

/**
 * 功能描述: <br>
 *
 * @author gaojc
 * @date 2020/9/8 17:07
 */
@Entity
@Table(name = "dict_field_map")
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
public class Dict implements Serializable {
    @Id
    @Column(name = "dict_map_id")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long dictMapId;

    @Column(name = "table_name")
    private String tableName;

    @Column(name = "field_name")
    private String fieldName;

    @Column(name = "dict_space")
    private String dictSpace;

    @Column(name = "f_type")
    private String fType;

    @Column(name = "f_desc")
    private String fDesc;

    @Column(name = "dict_field")
    private String dictField;

    @OneToMany(fetch = FetchType.EAGER)
    // @JoinColumn(name = "field_name", referencedColumnName = "dict_field",updatable=false)
    @JoinColumnsOrFormulas(value = {
            @JoinColumnOrFormula(column = @JoinColumn(name = "field_name", referencedColumnName = "dict_field", updatable = false)),
            @JoinColumnOrFormula(column = @JoinColumn(name = "dict_space", referencedColumnName = "dict_space", updatable = false))
    })
    private Set<MysqlDataDictionary> dictValues;

    public Dict() {
    }

    public Long getDictMapId() {
        return dictMapId;
    }

    public void setDictMapId(Long dictMapId) {
        this.dictMapId = dictMapId;
    }

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    public String getFieldName() {
        return fieldName;
    }

    public void setFieldName(String fieldName) {
        this.fieldName = fieldName;
    }

    public String getDictSpace() {
        return dictSpace;
    }

    public void setDictSpace(String dictSpace) {
        this.dictSpace = dictSpace;
    }

    public String getfType() {
        return fType;
    }

    public void setfType(String fType) {
        this.fType = fType;
    }

    public String getfDesc() {
        return fDesc;
    }

    public void setfDesc(String fDesc) {
        this.fDesc = fDesc;
    }

    public String getDictField() {
        return dictField;
    }

    public void setDictField(String dictField) {
        this.dictField = dictField;
    }

    public Set<MysqlDataDictionary> getDictValues() {
        return dictValues;
    }

    public void setDictValues(Set<MysqlDataDictionary> dictValues) {
        this.dictValues = dictValues;
    }
}

